package com.ysd.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ysd.Dao.Impl.CompanyDaoImpl;
import com.ysd.Dao.Impl.DesignDaoImpl;
import com.ysd.Dao.Impl.NewsClassIficationDaoImpl;
import com.ysd.Dao.Impl.NewsDaoImpl;
import com.ysd.Dao.Impl.ProductDaoImpl;
import com.ysd.Dao.Impl.ProductSeriesDaoImpl;
import com.ysd.entity.Company;
import com.ysd.entity.Design;
import com.ysd.entity.News;
import com.ysd.entity.NewsClassiIfication;
import com.ysd.entity.Product;
import com.ysd.entity.ProductSeries;


public class ProductDetailServlet extends HttpServlet {
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
				//调用产品实现类的方法
				int pId = Integer.parseInt(request.getParameter("productId"));
				ProductDaoImpl pDao = new ProductDaoImpl();
				Product cx = pDao.getProductListById(pId);//指定id的产品详情
				request.setAttribute("cx", cx);
				ProductSeriesDaoImpl psDao = new ProductSeriesDaoImpl();
				List<ProductSeries> ps = psDao.getProductSeriesList();//产品系列
				request.setAttribute("ps", ps);
				ProductDaoImpl cpDao = new ProductDaoImpl();
				List<Product> cdx = cpDao.getProductListAll();//产品表所有数据
				request.setAttribute("cdx", cdx);
				
				
		request.getRequestDispatcher("productdetails.jsp").forward(request, response);
	
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
